import axios from '@/plugins/axios'

// 职位各状态数据统计
export async function positionStatusCount (params) { // 获取状态统计数据 *******
  try {
    let res = await axios.get(`/position/statusList`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}

// 查询职位列表
export async function positionList (params) { // 职位列表 ******
  try {
    let res = await axios.post(`/position/positionList`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}

export async function modifyOrAddPosition (params) { // 创建修改职位 ******
  try {
    let res = await axios.post(`/position/create`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// // 获取职位详情
// export async function positionCreate (params) {
//   try {
//     let res = await axios.post(`/position/create`, params)
//     return res.data
//   } catch (err) {
//     console.log(err)
//     return err.response.data
//   }
// }

// 获取职位详情
export async function positionPositionDetail (params) {
  try {
    let res = await axios.post(`/position/positionInfo`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 获取职位详情
export async function positionInfo (params) { // 职位详细 ******
  try {
    let res = await axios.post(`/position/positionInfo`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}

// 获取筛表单项
export async function positionQueryConditions (params) { // 获取筛选条件 ******
  try {
    let res = await axios.get(`/static/position/searchConditions.json`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}

// 查询职位显示设置
export async function positionPositionShowConfig (params) { // 头部设计 ******
  try {
    let res = await axios.get(`/static/position/columns.json`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}

// 获取职位模板
export async function positionPositionTemplate (params) { // 职位模板 ******
  try {
    let res = await axios.get(`/static/position/positionTemplate.json`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 改变状态
export async function modifyStatus (params) { // 改变状态 ******
  try {
    let res = await axios.post(`/position/changeStatus`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 下拉列表展示数据
export async function positionNames (params) {
  try {
    let res = await axios.post(`/jobboard/positions/position/positionNames`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}

// 获取职业类别树状结构接口
export async function positionCategorySelectAll (params) {
  try {
    let res = await axios.post(`/jobboard/settings/positionCategory/selectAll`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}

// 修改/新增用户显示设置
export async function positionAddOrModifyShowConfig (params) {
  try {
    let res = await axios.post(`/jobboard/positions/positionShow/addOrModifyShowConfig`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}

// 获取职位模板中的字段
export async function positionPositionTemplateFields (params) {
  try {
    let res = await axios.post(`/jobboard/positions/position/positionTemplateFields`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}

// 用户根据输入返回列表
export async function getCompanyNameList (params) {
  try {
    let res = await axios.get(`/jobboard/settings/company/nameList?name=${params}`)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
export async function auditPosition (params) {
  try {
    let res = await axios.post(`/jobboard/positions/position/auditPosition`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}

export async function provinceCityList (params) {
  try {
    let res = await axios.post(`/jobboard/positions/city/provinceCityList`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}

// 获取筛表单项
export async function positionOne (params) {
  try {
    let res = await axios.post(`/jobboard/positions/position/positionOne`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 分配的猎头账号，多个以英文逗号分开
export async function postPosition (params) {
  try {
    let res = await axios.post(`/jobboard/positions/vendor/postPosition`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 分配的猎头账号，多个以英文逗号分开
export async function cancelPosition (params) {
  try {
    let res = await axios.post(`/jobboard/positions/vendor/cancelPosition`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
